<template>
	<view class="content">

		<Loading class="loading-box" v-show="!isLoading" :isStatus='loadStatus'></Loading>
		<view class="top">
			
			
			<cu-custom :isBack="true" bgColor="custom-top">
				<block slot="backText" class="titilestyle"></block>
			</cu-custom>
			<view class="mask">
				
			</view>

			<image :src="info.logo" mode="aspectFill"></image>
		</view>


		<view class="info-box">


			<view class="head flex justify-between">
				<view class="left ">
					<text class="name text-bold text-xl">{{info.name}}</text>
					<view class="attr text-gray">
						<text class="margin-right-sm">社员 {{info.number}}</text> |
						<text class="margin-left-sm">类别 {{info.type}}</text>
					</view>
					<view class="tag-box">
						<view class='cu-tag radius tag-style' v-for="(tag,i) in info.tag">{{tag}}</view>
					</view>
				</view>
				<view class="right">
					<image :src="info.logo" mode="aspectFill"></image>
				</view>
			</view>
		
		
			<scroll-view scroll-y="true" class="d-i-box bg-white">
				<view class="desc" v-html="info.desc">

				</view>

				<scroll-view scroll-x="true" class="img-box" v-if="info.img">
					<view class="img-boxes">
						<image src="../../static/1.png" mode="heightFix" v-for="(item,i) in 4"></image>
					</view>
				</scroll-view>


				<view class="foot"></view>
			</scroll-view>
		</view>


		<view class="applay-btn middle round" @click="applay()">
			申请社团
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: null,
				isLoading: false,
				loadStatus: 'load',
				clud_id: -1,
			}
		},
		onLoad(option) {
			let id = option.id;
			this.clud_id = id;
			this.isLoading = true;
			this.getInfo(id);

		},

		methods: {
			//获取社团详情
			getInfo(id) {
				this.apiRequest('/buyer/ClubInfo', {
					club_id: id,
				}, 0, 'POST').then(res => {
					this.isLoading = true;
					if (res.code == 200) {
						this.info = res.data;
					} else {
						this.error(res.msg);
					}
				}).catch(() => {
					this.error('出错了！请稍后再试');
				})
			},
			error(msg) {
				uni.showModal({
					content: msg || '出错了！请稍后再试',
					showCancel: false,
					success: () => {
						uni.navigateBack({
							delta: 1
						})
					}
				})
			},
			//申请社团
			applay() {
				uni.navigateTo({
					url: "./applay?club_id=" + this.clud_id
				})

			}




		}




	}
</script>

<style lang="scss">
	.content {
		width: 100vw;
		height: 100vh;
		$pw: calc(100vw*(30/750));

		.top {
			width: inherit;
			height: calc(100vw*(320/750));
			position: relative;
			
			.mask{
				position: absolute;
				z-index: 9;
				top: 0;
				width: 100%;
				height: 100%;
				background-color: rgba(0, 0, 0, 0.5);
			}

			image {
				width: 100%;
				height: 100%;
				position: absolute;
				top: 0;
				z-index: 1;
				filter: blur(10upx);
			}
		}

		.info-box {
			width: inherit;
			margin-top: -3%;
			z-index: 99;
			height: 75%;
			border-top-left-radius: 20rpx;
			border-top-right-radius: 20rpx;
			.d-i-box{
				width: inherit;
				height: 80%;
			}
			.head {
				background-color: white;
				padding: calc(100vw*(30/750));
				border-top-left-radius: 20rpx;
				border-top-right-radius: 20rpx;
				.left {
					margin-right: 10rpx;
					.attr {
						margin-top: $pw;
					}
					.tag-box {
						.tag-style {
							margin-top: calc(100vw*(20/750));
							margin-right: calc(100vw*(20/750));
							color: #838383;
						}
					}

				}

				.right {
					image {
						border-radius: 20rpx;
						width: calc(100vw*(180/750));
						height: calc(100vw*(180/750));
					}
				}
			}

			.desc {
				padding: 0 $pw $pw $pw;
				width: inherit;
				font-size: calc(100vw*(28/750));
				font-weight: 500;
				color: #333333;
				background: #FFFFFF;
				line-height: calc(100vw*(48/750));
			}

			.img-box {
				width: inherit;
				height: calc(100vw*(360/750));

				.img-boxes {
					width: inherit;
					height: inherit;
					display: -webkit-box;
					flex-direction: row;

					image {
						max-width: calc(100vw*(640/750));
						height: inherit;
						display: inherit;
						margin-left: $pw;
						border-radius: calc(100vw*(20/750));
					}
				}
			}



		}

		.applay-btn {
			width: calc(100vw*(690/750));
			height: calc(100vw*(100/750));
			background: #1270E0;
			margin-left: calc(100vw*(30/750));
			color: white;
			font-size: calc(100vw*(32/750));
			font-weight: 800;
			position: fixed;
			z-index: 999;
			bottom: calc(100vw*(40/750));
		}


	}
</style>
